<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">点击</button>
</body>
</html>

<script>
    //DOM0事件优点：HTML和Js 分离
    //DOM0事件缺点：兼容性差，代码冗余  无法同时添加多个事件
    var btn = document.getElementById('btn');
    //被覆盖了
    btn.onclick = function(){
        console.log('点击了1')
    }
    btn.onclick = function(){
        console.log('点击了2')
    }
</script>